package DesignPatern.A02_工厂模式.QXB.A01_基本模式;

/**
 * @Author: Du
 * @Date: 2021/7/20 12:29
 */
public class A01_Main
{
    public static void main(String[] args)
    {
        //定义一个用于创建对象的接口
        AbstractHumanFactory yinyanglu = new HumanFactory();
        //让子类决定实例化那些类，工厂方法使一个类的实例化延迟到其子类
        Human whiteHuman = yinyanglu.crateHuman(WhiteHuman.class);
        whiteHuman.getColor();
        whiteHuman.talk();
        
        Human yellowHuman = yinyanglu.crateHuman(YellowHuman.class);
        yellowHuman.getColor();
        yellowHuman.talk();
        
        Human blackHuman = yinyanglu.crateHuman(BlackHuman.class);
        blackHuman.getColor();
        blackHuman.talk();
    }
}
